﻿define(['knockout', 'rep/UserRepository'], function (ko, UserRepository) {
    return function UserInfoViewModel() {
        //construction logic
        this.init = function () {
            var currentUser = UserRepository.GetCurrentUser();
            this.UserName = ko.observable(currentUser.UserName);
            this.Roles = ko.observableArray(currentUser.Rol);
            this.CurrentRol = ko.observable(this.Roles()[0]);
        };

        this.UserName = "";
        this.Roles = null;
        this.CurrentRol = null;

        //contruction execution
        this.init();
    }
});